fix(accounts): say what a failed personal principal actually needs - #31
Merged
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Creating a personal principal against an older auth plane fails with a raw Postgres message naming a column the client never sent:
The cause is server-side and worth recording. On that schema vintage
principalsstill carries the mask itself (allowed_mask bit(bitlen), NOT NULL), and the generatedcreate_principalsizes it by looking the width up at runtime:With no visible permission row the lookup yields NULL,
repeat('1', NULL)is NULL, and the insert trips the constraint — so the failure surfaces as a NOT NULL violation rather than as "you have no permission row".create_org_principalreads the org SPRT, which does have rows, which is why only the personal path breaks. Later schemas moved the mask toprincipal_scope_overrides, where an absent row means "inherits", and drop the column entirely.Nothing client-side can supply the width, so this only translates the error into the two things that do work — scope it to an organization, or update the auth plane — through the existing
explainFailure(renamed from the module-privateexplainso it can be tested), which everyrethrowalready passes through.Testing
explainFailurerewrites the mask constraint and leaves an unrelated failure (permission denied for table principals) byte-identical. Accounts build, lint and 48 tests green.Link to Devin session: https://app.devin.ai/sessions/04636534e07048089ffb6b78142e12cd
Requested by: @pyramation